use bumpalo::Bump;
use zen_expression::lexer::Lexer;
use zen_expression::parser::Parser;
use zen_expression::Isolate;
use zen_expression::Variable;

struct SortTest {
    src: &'static str,
    input: Variable,
    expected: &'static str,
}

#[test]
fn slice_negative_index_test() {
    // 测试负数索引的切片功能
    let mut isolate = Isolate::new();
    
    // 测试数组切片 [1, 2, 3, 4, 5][-3:-1] 应该返回 [3, 4]
    let result = isolate.run_standard("[1, 2, 3, 4, 5][-3:-2]").unwrap();
    if let Variable::Array(arr) = result {
        println!("{:?}", arr);
        let arr = arr.borrow();
        assert_eq!(arr.len(), 2, "[-3:-2] should return 2 elements");
        assert_eq!(arr[0], Variable::Number(3.into()));
        assert_eq!(arr[1], Variable::Number(4.into()));
    } else {
        panic!("Expected array result for [-3:-1]");
    }
}
